{% extends "base.html" %}
{% load url from future %}
{% load humanize %}

{% block content %}
    <table>
        <tr>
            <th>Galaxy</th>
            <th>Solar System</th>
            <th>Planet</th>
            <th>Player</th>
            <th>Last Update</th>
        </tr>
        {% for galaxy, solar_systems in univers.items %}
            <tr>
                <th colspan="5">
                    {{ galaxy }}
                </th>
            </tr>
            {% for ss, planets in solar_systems.items %}
                <tr>
                    <td />
                    <th colspan="4">
                        {{ ss|escape }}
                    </th>
                </tr>
                {% for pos, planet in planets.items %}
                    <tr>
                        <td colspan="2" />
                        <td>
                            <a href="{% url 'show_planet' planet.id %}">
                                {{ planet.galaxy }}:{{ planet.ss|escape }}:{{ planet.position}}
                            </a>
                        </td>
                        <td>
                            <a href="{% url 'show_player' planet.player.id %}">
                                {{ planet.player }}
                            </a>
                        </td>
                        <td>
                            {{ planet.last_update|naturaltime }}
                        </td>
                    </tr>
                {% endfor %}
            {% endfor %}
        {% endfor %}
    </table>

{% endblock %}
